package com.learn.mapstruct.enumMapping;

import com.learn.mapstruct.enumMapping.model.Enum1;
import com.learn.mapstruct.enumMapping.model.Enum2;
import com.learn.mapstruct.enumMapping.model.Enum3;
import com.learn.mapstruct.enumMapping.model.Enum4;
import org.mapstruct.EnumMapping;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;

@Mapper
public interface EnumMappingMapper {

    @EnumMapping(nameTransformationStrategy = MappingConstants.SUFFIX_TRANSFORMATION, configuration = "_SUFFIX")
    Enum2 to(Enum1 data);

    @EnumMapping(nameTransformationStrategy = MappingConstants.STRIP_SUFFIX_TRANSFORMATION, configuration = "_SUFFIX", unexpectedValueMappingException = RuntimeException.class)
    Enum1 to(Enum2 data);

    @EnumMapping(nameTransformationStrategy = MappingConstants.CASE_TRANSFORMATION, configuration = "lower")
    Enum3 from(Enum1 data);

    @EnumMapping(nameTransformationStrategy = MappingConstants.CASE_TRANSFORMATION, configuration = "upper")
    Enum1 from(Enum3 data);

    @EnumMapping(nameTransformationStrategy = MappingConstants.STRIP_PREFIX_TRANSFORMATION, configuration = "PREFIX_")
    Enum1 convert(Enum4 data);

    @EnumMapping(nameTransformationStrategy = MappingConstants.PREFIX_TRANSFORMATION, configuration = "PREFIX_")
    Enum4 convert(Enum1 data);
}
